﻿using System.Collections.Generic;
using System.Linq;
using MaxStoreErp.Core.Extensions;
using MaxStoreShop.Domain.Directories;
using MaxStoreShop.Logic.RepositoriesContracts.Directories;

namespace MaxStoreShop.Dal.Repositories.Directories
{
    public class SupplierRepository : RepositoryBase, ISupplierRepository
    {
        public IEnumerable<Supplier> GetSuppliers()
        {
            return Context.Suppliers.AsNoTracking().NotDeleted();
        }

        public void DeleteSupplier(int supplierId)
        {
            SafeDelete(Context.Suppliers.First(c => c.Id == supplierId));
        }

        public void SaveSupplier(Supplier supplier)
        {
            SaveEntity(supplier);
        }
    }
}
